{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>LMS</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="{% static 'lms/bootstrap5/css/bootstrap.min.css' %}" rel="stylesheet" type="text/css">
    <link href="{% static 'lms/bootstrap5/font/bootstrap-icons.css' %}" rel="stylesheet" type="text/css">
    <link href="{% static 'lms/css/style.css' %}" rel="stylesheet" type="text/css">
    <link href="{% static 'lms/bootstrap-fileinput-v5/css/fileinput.min.css' %}" rel="stylesheet" type="text/css">
    <script src="{% static 'lms/bootstrap5/js/bootstrap.js' %}"></script>
    <script src="{% static 'lms/js/jquery-3.6.1.min.js' %}"></script>
    <script src="{% static 'lms/bootstrap-fileinput-v5/js/fileinput.min.js' %}"></script>
    <script src="{% static 'lms/bootstrap-fileinput-v5/js/locales/zh.js' %}"></script>
    <script src="{% static 'lms/js/main.js' %}"></script>
</head>
<body>
<div class="container">
    <nav class="navbar mybar">
        <div class="container-fluid">
            <span class="navbar-brand" style="color:white;">
                <img src="{% static 'lms/image/logo.png' %}" alt="学院logo" width="35" height="35" class="d-inline-block"> 图书管理系统
            </span>
            <div class="dropdown">
                <a href="#" class="d-flex align-items-center text-white text-decoration-none dropdown-toggle" id="dropdownUser1" data-bs-toggle="dropdown" aria-expanded="false">
                    <img src="{% static 'lms/image/photo.png' %}" width="30" height="30" class="rounded-circle">
                    <span class="d-none d-sm-inline mx-1">欢迎{{ request.session.username }}</span>
                </a>
                <ul class="dropdown-menu text-small shadow" aria-labelledby="dropdownUser1">
                    <li><a class="dropdown-item" href="#">编辑资料</a></li>
                    <li><a class="dropdown-item" href="#">修改密码</a></li>
                    <li>
                        <hr class="dropdown-divider">
                    </li>
                    <li><a class="dropdown-item" href="/lms/logout">退出登录</a></li>
                </ul>
            </div>
        </div>
    </nav>
    <div class="container-fluid"  style="border-right: 1px solid #DDDDDD;">
        <div class="row flex-nowrap">
            <div class="b-example-divider main"></div>
            <div class="p-3 bg-white" style="width: 280px;">
                <ul class="list-unstyled">
                  <li class="mb-1">
                    <button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#home-collapse" aria-expanded="true">
                      图书信息管理
                    </button>
                      <ul class="nav flex-column btn-toggle-nav small">
                    <div class="collapse show" id="home-collapse">
                        <li><a id="h1_a" href="#">图书列表</a></li>
                        <li><a id="h2_a" href="#">图书信息录入</a></li>
                    </div></ul>
                  </li>
                  <li class="mb-1">
                    <button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#dashboard-collapse" aria-expanded="false">
                      图书借阅管理
                    </button>
                    <div class="collapse" id="dashboard-collapse">
                      <ul class="nav flex-column btn-toggle-nav small">
                        <li><a id="h3_a" href="#">图书借阅记录</a></li>
                      </ul>
                    </div>
                  </li>
                  <li class="mb-1">
                    <button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#orders-collapse" aria-expanded="false">
                      用户管理
                    </button>
                    <div class="collapse" id="orders-collapse">
                      <ul class="nav flex-column btn-toggle-nav small">
                        <li><a id="h4_a" href="#">用户列表</a></li>
                        <li><a id="h5_a" href="#">新增用户</a></li>
                      </ul>
                    </div>
                  </li>
                  <li class="border-top my-3"></li>
                  <li class="mb-1">
                    <button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#account-collapse" aria-expanded="false">
                      个人中心
                    </button>
                    <div class="collapse" id="account-collapse">
                      <ul class="nav flex-column btn-toggle-nav small">
                        <li><a id="h6_a" href="#">编辑资料</a></li>
                        <li><a id="h7_a" href="#">修改密码</a></li>
                      </ul>
                    </div>
                  </li>
                </ul>
              </div>
            <div class="b-example-divider"></div>
            <div class="tab-content" style="width: 75%;">
                <div class="tab-pane fade show active" id="h1">
                    <nav aria-label="breadcrumb" style="margin-top: 10px;">
                      <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">图书信息管理</a></li>
                        <li class="breadcrumb-item active" aria-current="page">图书列表</li>
                      </ol>
                    </nav>
                    <div class="table-responsive">
                        <table class="table table-sm">
                            <thead>
                                <tr>
                                    <th>序号</th>
                                    <th>图书编号</th>
                                    <th>图书名称</th>
                                    <th>作者</th>
                                    <th>出版社名称</th>
                                    <th>出版日期</th>
                                    <th>图书状态</th>
                                </tr>
                            </thead>
                            <tbody>
                                {% for i in res %}
                                    <tr>
                                        <td>{{ i.id }}</td>
                                        <td>{{ i.bookno }}</td>
                                        <td>{{ i.bookname }}</td>
                                        <td>{{ i.authorname }}</td>
                                        <td>{{ i.publisher }}</td>
                                        <td>{{ i.publishdate }}</td>
                                        <td>{% if i.bookstatus == 0 %}
                                            闲置
                                            {% else %}
                                            借阅中
                                        {% endif %} </td>
                                    </tr>
                                {% endfor %}
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="tab-pane fade" id="h2">
                    <nav aria-label="breadcrumb" style="margin-top: 10px;">
                      <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">图书信息管理</a></li>
                        <li class="breadcrumb-item active" aria-current="page">图书信息录入</li>
                      </ol>
                    </nav>
                    <form method="post" action="/lms/addbook" enctype="multipart/form-data">
                        <div class="row" style="">
                            <label for="bookno" class="col-sm-2 col-form-label">图书编号</label>
                            <div class="col-sm-6"><input type="text" class="form-control" id="bookno" name="bookno" aria-describedby="bookno_help"></div>
                            <div id="bookno_help" class="col-sm-2 form-text" style="margin-top: 10px;">格式：XXX-XXXXXX</div>
                        </div>
                        <div class="row" style="margin-top: 10px;">
                            <label for="bookname" class="col-sm-2 col-form-label">图书名称</label>
                            <div class="col-sm-6"><input type="text" class="form-control" id="bookname" name="bookname"></div>
                        </div>
                        <div class="row" style="margin-top: 10px;">
                            <label for="author" class="col-sm-2 col-form-label">作者</label>
                            <div class="col-sm-6"><input type="text" class="form-control" id="author" name="author"></div>
                        </div>
                        <div class="row" style="margin-top: 10px;">
                            <label for="publisher" class="col-sm-2 col-form-label">出版社</label>
                            <div class="col-sm-6"><input type="text" class="form-control" id="publisher" name="publisher"></div>
                        </div>
                        <div class="row" style="margin-top: 10px;">
                            <label for="publishdate" class="col-sm-2 col-form-label">出版日期</label>
                            <div class="col-sm-6"><input type="text" class="form-control" id="publishdate" name="publishdate" aria-describedby="publishdate_help"></div>
                            <div id="publishdate_help" class="col-sm-2 form-text" style="margin-top: 10px;">格式：XXXX-XX-XX</div>
                        </div>
                        <div class="row" style="margin-top: 10px;">
                            <label for="cover" class="col-sm-2 col-form-label">图书封面</label>
                            <div class="col-sm-6"><input type="file" name="cover" class="file-upload" id="cover"></div>
                        </div>
                        <div class="row" style="text-align: center;margin-bottom: 50px;margin-top: 50px;">
                            <div><button type="submit" class="btn btn-info" style="width: 150px;">提交</button></div>
                        </div>
                    </form>
                </div>
                <div class="tab-pane fade" id="h3">
                    <nav aria-label="breadcrumb" style="margin-top: 10px;">
                      <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">图书借阅管理</a></li>
                        <li class="breadcrumb-item active" aria-current="page">图书借阅记录</li>
                      </ol>
                    </nav>
                    <table class="table table-sm">
                        <thead>
                            <tr>
                                <th>序号</th>
                                <th>图书编号</th>
                                <th>图书名称</th>
                                <th>借阅人</th>
                                <th>借阅状态</th>
                                <th>借阅日期</th>
                                <th>应还日期</th>
                                <th>归还日期</th>
                            </tr>
                        </thead>
                        <tbody>
                            {% for i in borrow %}
                                <tr>
                                    <td>{{ i.id }}</td>
                                    <td>{{ i.bookno_id }}</td>
                                    <td>{{ i.bookno.bookname }}</td>
                                    <td>{{ i.readerno.readername }}</td>
                                    <td>{% if i.borrowstatus == 0 %}
                                        <b class="text-info">借阅中</b>
                                        {% elif i.borrowstatus == 1 %}
                                        <b class="text-success">已还</b>
                                        {% else %}
                                        <b class="text-danger">超期</b>
                                    {% endif %} </td>
                                    <td>{{ i.borrowdate }}</td>
                                    <td>{{ i.shoulddate }}</td>
                                    <td>{{ i.returndate }}</td>
                                </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
                <div class="tab-pane fade" id="h4">
                    <nav aria-label="breadcrumb" style="margin-top: 10px;">
                      <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">用户管理</a></li>
                        <li class="breadcrumb-item active" aria-current="page">用户列表</li>
                      </ol>
                    </nav>
                </div>
                <div class="tab-pane fade" id="h5">
                    <nav aria-label="breadcrumb" style="margin-top: 10px;">
                      <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">用户管理</a></li>
                        <li class="breadcrumb-item active" aria-current="page">新增用户</li>
                      </ol>
                    </nav>
                </div>
                <div class="tab-pane fade" id="h6">
                    <nav aria-label="breadcrumb" style="margin-top: 10px;">
                      <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">个人中心</a></li>
                        <li class="breadcrumb-item active" aria-current="page">编辑资料</li>
                      </ol>
                    </nav>
                </div>
                <div class="tab-pane fade" id="h7">
                    <nav aria-label="breadcrumb" style="margin-top: 10px;">
                      <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">个人中心</a></li>
                        <li class="breadcrumb-item active" aria-current="page">修改密码</li>
                      </ol>
                    </nav>
                </div>
            </div>
        </div>
    </div>
    <div class="container">
            <div class="row footer">
                <p>天津工业大学生命科学学院
                    <br/>
                    地址:天津市西青区宾水西道399号 电话:022-83956686 邮编:300387
                </p>
            </div>
        </div>
</div>
</body>
</html>